package com.yunupmall.mapper.commoditymapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunupmall.api.fordentity.Specs;
import com.yunupmall.entity.admin.commoditypojo.UpSpecs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
public interface SpecsMapper extends BaseMapper<Specs> {
    //批量添加类别颜色
    int AddSpecsColor(Map map);

    //批量添加类别规格
    int AddSpecs(@Param("list") List<UpSpecs> upSpecs);

    //查询该类别下的规格
    @Select("SELECT * from specs where k_id=#{k_id} LIMIT #{thissize},#{pagesize} ")
    List<Specs> selectUpSpecs(@Param("thissize") Integer thissize, @Param("pagesize") Integer pagesize, @Param("k_id") Integer kid);

    @Select("select count(*) as count from specs where k_id=#{K_id}")
    int getDataCount(@Param("K_id") Integer id);


    @Delete("delete from specs where id=#{id}")
    int deleteData(@Param("id") Integer id);
}
